package com.atguigu.gulimall.order.config;


import com.atguigu.gulimall.order.interceptor.LoginUserInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

//使用实现HandlerInterceptor接口创建好prehandler拦截器之后
//要配置Interceptor拦截哪些controller

@Configuration
public class OrderWebConfiguration implements WebMvcConfigurer {

    @Autowired
    LoginUserInterceptor loginUserInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //拦截所有的controller方法
       registry.addInterceptor(loginUserInterceptor).addPathPatterns("/**");
    }
}
